package com.lxj.cms.manage.action.user;

import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;
import org.hibernate.Criteria;
import org.hibernate.criterion.Order;

import com.lxj.cms.manage.action.ManageBaseAction;
import com.lxj.core.action.IBaseAction;
import com.lxj.core.entity.SYSUserGroupEntity;

@SuppressWarnings("serial")
@Results( { @Result(name = "index", location = "/WEB-INF/cmsManage/user/userGrop.jsp"), @Result(name = "userGropEdit", location = "/WEB-INF/cmsManage/user/userGropEdit.jsp") })
public class UserGropAction extends ManageBaseAction implements IBaseAction {

	private SYSUserGroupEntity userGroup;

	@Override
	public String editPage() {
		userGroup = new SYSUserGroupEntity();
		return "userGropEdit";
	}

	@Override
	public String index() {
		return "index";
	}
	@Override
	public void dataList() {
		Criteria criteria = this.createCriteria(SYSUserGroupEntity.class);
		criteria.addOrder(Order.desc("beanLastModidyfiTime"));
		this.setResult(criteria);
	}

	@Override
	public String preservation() {
		// TODO Auto-generated method stub
		this.getBaseService().saveOrUpdate(userGroup);
		return index();
	}

	@Override
	public String remove() {
		this.getBaseService().delete(this.getOptionId(), SYSUserGroupEntity.class);
		return index();
	}

	public SYSUserGroupEntity getUserGroup() {
		return userGroup;
	}

	public void setUserGroup(SYSUserGroupEntity userGroup) {
		this.userGroup = userGroup;
	}

}
